package com.bw.mallshop.mvvm.model;

import com.bw.common.entity.BaseEntity;
import com.bw.common.mvvm.model.BaseModel;
import com.bw.common.network.HttpType;
import com.bw.common.network.RetrofitFactory;
import com.bw.mallshop.entity.SKillEntity;
import com.bw.mallshop.entity.SecKillEntity;
import com.bw.mallshop.repository.ApiService;

import java.util.Map;

import io.reactivex.Observable;

public class SKillListModel extends BaseModel {

    //获取秒杀列表接口
    public Observable<BaseEntity>requestSkillList(){
        Observable<SecKillEntity>observable= RetrofitFactory.factory(HttpType.TOKEN)
                .createRetrofit().create(ApiService.class)
                .requestSecKilles();
        return changeObservable(observable);
    }
    //秒杀接口请求
    public Observable<BaseEntity>requestSKill(Map<String,Object>parames){
        Observable<SKillEntity>observable = RetrofitFactory.factory(HttpType.TOKEN)
                .createRetrofit().create(ApiService.class)
                .requestAddSecKill(createBody(parames));
        return changeObservable(observable);
    }
}
